<!--播放器-->
<div id="QPlayer" style="z-index:999">
    <link rel="stylesheet" href="/templates/themes/default/static/css/player.css">
    <div id="pContent">
        <div id="player">
            <span class="cover"></span>
            <div class="ctrl">
                <div class="musicTag marquee">
                    <strong>Title</strong>
                    <span> - </span>
                    <span class="artist">Artist</span>
                </div>
                <div class="progress">
                    <div class="left">play</div>
                    <div class="contr">
                        <div class="rewind icon"></div>
                        <div class="playback icon"></div>
                        <div class="fastforward icon"></div>
                    </div>
                    <div class="right">
                        <div class="liebiao icon"></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="ssBtn">
            <div class="adf"></div>
        </div>
    </div>
    <ol id="playlist"></ol>
</div>

<!--看板娘-->
<div id="landlord" style="left:80%;bottom:0px;">
    <div class="message" style="opacity:0"></div>
    <canvas id="live2d" width="500" height="560" class="live2d"></canvas>
    <div class="live_talk_input_body">
        <div class="live_talk_input_name_body">
            <!--<input name="name" type="text" class="live_talk_name white_input" id="AIuserName" autocomplete="off" placeholder="你的名字" />-->
        </div>
        <div class="live_talk_input_text_body">
            <!--<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀？"/>-->
            <!--<button type="button" class="live_talk_send_btn" id="talk_send">发送</button>-->
        </div>
    </div>
    <input name="live_talk" id="live_talk" value="1" type="hidden" />
    <div class="live_ico_box">
        <div class="live_ico_item type_info" id="showInfoBtn"></div>
        <div class="live_ico_item type_talk" id="showTalkBtn"></div>
        <div class="live_ico_item type_music" id="musicButton"></div>
        <!--<div class="live_ico_item type_youdu" id="youduButton"></div>-->
        <!--<div class="live_ico_item type_quit" id="hideButton"></div>-->
        <input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
        <!--<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>-->
        <!--<input name="live2dBGM" value="音乐地址" type="hidden">-->
        <!--<input id="duType" value="douqilai,l2d_caihong" type="hidden">-->
    </div>
</div>


<footer id="footer" class="footer bg-white">
    <div class="footer-social">
        <div class="footer-container clearfix">
            #include("./social.html")
        </div>
    </div>
    <div class="footer-meta">
        <div class="footer-container">
            <div class="meta-item meta-copyright">
                <div class="meta-copyright-info">
                    <a href="${site_url()}" class="info-logo">
                        step by step,it will come.
                    </a>
                    <div class="info-text">
                        <p>愿你出走半生，归来仍是少年。</p>
                        <p>至今，博客已稳定运行<span id="days"></span>天</p>
                        <p><span id="year"></span> © Parasomnia</p>
                    </div>
                </div>
            </div>

            <div class="meta-item meta-posts">
                <h3 class="meta-title">最新文章</h3>
                #for(article : recent_articles(8))
                <li>
                    <a href="${permalink()}">${title()}</a>
                </li>
                #end
            </div>

            <div class="meta-item meta-comments">
                <h3 class="meta-title">最新评论</h3>
                #for(comm : recent_comments(8))
                <li>
                    <a href="${site_url('/article/')}${comm.cid}#comment-${comm.coid}">${comm.author}：${comm.content}</a>
                </li>
                #end
            </div>
        </div>
    </div>
</footer>

#if(is_post)
<div id="directory-content" class="directory-content">
    <div id="directory"></div>
</div>
<script>
    $('#directory').html('');
    var postDirectoryBuild = function() {
        var postChildren = function children(childNodes, reg) {
                var result = [],
                    isReg = typeof reg === 'object',
                    isStr = typeof reg === 'string',
                    node, i, len;
                for (i = 0, len = childNodes.length; i < len; i++) {
                    node = childNodes[i];
                    if ((node.nodeType === 1 || node.nodeType === 9) &&
                        (!reg ||
                        isReg && reg.test(node.tagName.toLowerCase()) ||
                        isStr && node.tagName.toLowerCase() === reg)) {
                        result.push(node);
                    }
                }
                return result;
            },
            createPostDirectory = function(article, directory, isDirNum) {
                var contentArr = [],
                    titleId = [],
                    levelArr, root, level,
                    currentList, list, li, link, i, len;
                levelArr = (function(article, contentArr, titleId) {
                    var titleElem = postChildren(article.childNodes, /^h\d$/),
                        levelArr = [],
                        lastNum = 1,
                        lastRevNum = 1,
                        count = 0,
                        guid = 1,
                        id = 'directory' + (Math.random() + '').replace(/\D/, ''),
                        lastRevNum, num, elem;
                    while (titleElem.length) {
                        elem = titleElem.shift();
                        contentArr.push(elem.innerHTML);
                        num = +elem.tagName.match(/\d/)[0];
                        if (num > lastNum) {
                            levelArr.push(1);
                            lastRevNum += 1;
                        } else if (num === lastRevNum ||
                            num > lastRevNum && num <= lastNum) {
                            levelArr.push(0);
                            lastRevNum = lastRevNum;
                        } else if (num < lastRevNum) {
                            levelArr.push(num - lastRevNum);
                            lastRevNum = num;
                        }
                        count += levelArr[levelArr.length - 1];
                        lastNum = num;
                        elem.id = elem.id || (id + guid++);
                        titleId.push(elem.id);
                    }
                    if (count !== 0 && levelArr[0] === 1) levelArr[0] = 0;

                    return levelArr;
                })(article, contentArr, titleId);
                currentList = root = document.createElement('ul');
                dirNum = [0];
                for (i = 0, len = levelArr.length; i < len; i++) {
                    level = levelArr[i];
                    if (level === 1) {
                        list = document.createElement('ul');
                        if (!currentList.lastElementChild) {
                            currentList.appendChild(document.createElement('li'));
                        }
                        currentList.lastElementChild.appendChild(list);
                        currentList = list;
                        dirNum.push(0);
                    } else if (level < 0) {
                        level *= 2;
                        while (level++) {
                            if (level % 2) dirNum.pop();
                            currentList = currentList.parentNode;
                        }
                    }
                    dirNum[dirNum.length - 1]++;
                    li = document.createElement('li');
                    link = document.createElement('a');
                    link.href = '#' + titleId[i];
                    link.innerHTML = !isDirNum ? contentArr[i] :
                        dirNum.join('.') + ' ' + contentArr[i] ;
                    li.appendChild(link);
                    currentList.appendChild(li);
                }
                directory.appendChild(root);
            };
        createPostDirectory(document.getElementById('post-content'),document.getElementById('directory'), true);
    };
    postDirectoryBuild();
</script>
#end
<script src="${theme_url('/static/js/headroom.min.js')}"></script>
<script src="//cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js"></script>
<script src="${theme_url('/static/js/instantclick.min.js')}"></script>
<script src="${theme_url('/static/js/jquery.min.js')}"></script>
<script src="${theme_url('/static/js/jquery.marquee.min.js')}"></script>

<script>
    var	playlist = [
        {title:"桜流し",artist:"宇多田ヒカル",mp3:"http://oyyblxz0e.bkt.clouddn.com/%E6%A1%9C%E6%B5%81%E3%81%97.mp3",cover:"http://p1.music.126.net/rOMeuBbPsVf0ihw_-q9iOw==/109951163081242244.jpg?param=130y130",},
        {title:"真夏の通り雨",artist:"宇多田ヒカル",mp3:"http://oyyblxz0e.bkt.clouddn.com/%E7%9C%9F%E5%A4%8F%E3%81%AE%E9%80%9A%E3%82%8A%E9%9B%A8.mp3",cover:"http://p1.music.126.net/-A8WxO4Kc3zZWthU_6_w8g==/1384285145623690.jpg?param=130y130",},
        {title:"Duvet",artist:"Bôa",mp3:"http://oyyblxz0e.bkt.clouddn.com/Duvet.mp3",cover:"http://p1.music.126.net/Tu-pZMMXmobh-5_I1RuYow==/1754820557937499.jpg?param=130y130",},
        {title:"命に嫌われている",artist:"芝麻Mochi",mp3:"http://oyyblxz0e.bkt.clouddn.com/%E8%8A%9D%E9%BA%BBMochi%20-%20%E5%91%BD%E3%81%AB%E5%AB%8C%E3%82%8F%E3%82%8C%E3%81%A6%E3%81%84%E3%82%8B%E3%80%82%EF%BC%88Cover%20%E5%88%9D%E9%9F%B3%E3%83%9F%E3%82%AF%EF%BC%89.mp3",cover:"http://p1.music.126.net/MxcZxB6tp_s1_qrH7IrcLg==/109951163055105607.jpg?param=130y130",},
        {title:"YOU",artist:"YURIA",mp3:"http://oyyblxz0e.bkt.clouddn.com/YOU.mp3",cover:"http://p1.music.126.net/Y_mGZ1jf4q-KswYXg-aDpA==/830131278970895.jpg?param=130y130",},
        {title:"残酷な天使のテーゼ",artist:"高橋洋子",mp3:"http://oyyblxz0e.bkt.clouddn.com/%E6%AE%8B%E9%85%B7%E3%81%AA%E5%A4%A9%E4%BD%BF%E3%81%AE%E3%83%86%E3%83%BC%E3%82%BC.mp3",cover:"http://p1.music.126.net/950Yua16aKfN8lzRHnWA0w==/864216139432210.jpg?param=130y130",},

    ];
    var isRotate = true;
    var autoplay = false;
</script>

<script src="${theme_url('/static/js/player.js')}"></script>
<script>

    function bgChange(){
        var lis= $('.lib');
        for(var i=0; i<lis.length; i+=2)
            lis[i].style.background = 'rgba(246, 246, 246, 0.5)';
    }
    window.onload = bgChange;
</script>
<script type="text/javascript">
    #if(is_post)
        var postDirectory = new Headroom(document.getElementById("directory-content"), {
            tolerance: 0,
            offset : 100,
            classes: {
                initial: "initial",
                pinned: "pinned",
                unpinned: "unpinned"
            }
        });
    #end
    var header = new Headroom(document.getElementById("header"), {
        tolerance: 10,
        offset : 80,
        classes: {
            initial: "animated",
            pinned: "slideDown",
            unpinned: "slideUp"
        }
    });
    header.init();
    $('#search-inp').keypress(function (e) {
        var key = e.which; //e.which是按键的值
        if (key == 13) {
            var q = $(this).val();
            if (q && q != '') {
                window.location.href = '/search/' + q;
            }
        }
    });
</script>
<script data-no-instant>
    InstantClick.on('change', function (isInitialLoad) {
        var blocks = document.querySelectorAll('pre code');
        for (var i = 0; i < blocks.length; i++) {
            hljs.highlightBlock(blocks[i]);
        }
        if (isInitialLoad === false) {
            if (typeof ga !== 'undefined') ga('send', 'pageview', location.pathname + location.search);
        }
    });
    InstantClick.init('mousedown');
</script>
<!-- 自定义js -->
<script type="text/javascript">
    //获取年份
    $("#year").text(new Date().getFullYear());

    $("#days").text(Math.floor((new Date().getTime()-new Date('2018-5-19').getTime())/86400000));
</script>

<!--看板娘-->
<script type="text/javascript" src="https://apps.bdimg.com/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
    var message_Path = 'templates/themes/default/static/live2d/';//资源目录，如果目录不对请更改
    var talkAPI = "";//如果有类似图灵机器人的聊天接口请填写接口路径
</script>
<script type="text/javascript" src="${theme_url('/static/live2d/js/live2d.js')}"></script>
<script type="text/javascript" src="${theme_url('/static/live2d/js/message.js')}"></script>
</body>
</html>